package com.hdyg.sixg.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hdyg.sixg.R;
import com.hdyg.sixg.entry.CountryBean;
import com.hdyg.sixg.entry.OilPhoneBean;

import java.util.List;

/**
 * @author CZB
 * @describe 话费/油卡充值价格适配器
 * @time 2019/3/20 14:22
 */
public class OilPriceAdapter extends BaseQuickAdapter<OilPhoneBean, BaseViewHolder> {
    public OilPriceAdapter(int layoutResId, @Nullable List<OilPhoneBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, OilPhoneBean item) {
        String str = String.format(mContext.getResources().getString(R.string.oil_price), item.getAmount());
        helper.setText(R.id.tv_price, str);
        if (item.isIs_select()){
            helper.setBackgroundRes(R.id.tv_price,R.mipmap.oil_price_select);
        }else {
            helper.setBackgroundRes(R.id.tv_price,R.mipmap.oil_price_gray);
        }
    }
}
